

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<script type="text/javascript" src="helpman_topicinit.js"></script>

<title>Lay Out a Diagram Automatically [Enterprise Architect User Guide]</title>

<meta name="keywords" content="Enterprise Architect, Sparx Systems, UML, Layout,Layout Diagram, Automatically,Autolayout,Autolayout Diagram,Autolayout Options,Diagram,Diagram Automatic Layout,Diagram Layout Options">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />

<link type="text/css" href="default.css" rel="stylesheet" />
<style type="text/css">
  A, A:Visited
  {
    color: #00F;
  }

  A:Active, A:Hover
  {
    color: #F00;
  }

  OL
  {
    margin: 5px 0 5px 48px;
  }

  UL
  {
    margin-bottom: 3px;
    margin-top: 0;
  }

  #nsr
  {
    background-color: #D4DFFF;
  }

  #nsr A
  {
    text-decoration: none;
  }

  #mainbody
  {
    padding: 8px;
  }

  .p_BodyText
  {
    padding: 5px 0;
  }
</style>



<style type="text/css" media="screen">
  BODY
  {
    background-color: #FFFFFF;
  }

  #nsr
  {
    padding: 6px 6px 0 6px;
    border-bottom: none;
    vertical-align: top;
    z-index: 2;
    visibility: visible;
    left: 0;
    top: 0;
    position: absolute;
  }

  #mainbody
  {
    left: 0;
    top: 0;
    margin: 0;
    position: absolute;
    padding: 10px;
    overflow: auto;
    height: 100%;
    z-index: 1;
    background-repeat: no-repeat;
    background-position: bottom right;
    background-attachment: fixed;
  }
</style>

<style type="text/css" media="print">
  #nsr
  {
    visibility: none;
  }

  #mainbody
  {
    overflow: visible;
  }
</style>
<script type="text/javascript" language="JavaScript" src="nonscroll.js"></script>

</head>
<body scroll="no">

<div id="page">



        <div id="content">
          <div id="content-inner">
          



  
          <div id="nsr">
            <table border="0" cellspacing="0" cellpadding="4" width="100%">
              <tr valign="top">
                <td align="left">
  


                  <p class="p_Heading1"><span class="f_Heading1">Lay Out a Diagram Automatically</span></p>



  
                </td>
                <td align="right">
                  <a href="introduction.htm" onmouseover="document.images.main.src='button_main_h.gif'" onmouseout="document.images.main.src='button_main.gif'">
                    <img name="main" src="button_main.gif" border=0 alt="Return to Introduction">
                  </a>&nbsp;
    
                  <a href="auto_route_layout.htm" onmouseover="document.images.prev.src='button_prev_h.gif'" onmouseout="document.images.prev.src='button_prev.gif'">
                    <img name=prev src="button_prev.gif" border=0 alt="Previous page" />
                  </a>&nbsp;
    
    
    
                  <a href="deletingdiagrams.htm" onmouseover="document.images.next.src='button_next_h.gif'" onmouseout="document.images.next.src='button_next.gif'">
                    <img name=next src="button_next.gif" border=0 alt="Next page" />
                  </a>
    
    
                </td>
              </tr>
            </table>
          </div>
          <div id="mainbody">
  


                <p class="p_BodyText"><span class="f_BodyText">Enterprise Architect provides the facility to layout diagrams automatically. This creates a tree-based structure from the diagram elements and relationships in a diagram. Owing to the complexity of many diagrams, you might then have to do some manual 'tweaking'.</span></p>
<div style="text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 5px 0px 5px 13px;"><table cellspacing="0" cellpadding="2" border="0" style="border: none; border-spacing:0px;">
<tr style="text-align:left;vertical-align:bottom;">
<td valign="bottom" width="952" bgcolor="#efeff7" style="width:952px; background-color:#efeff7;"><p class="p_TiporNote" style="border-top: none; border-right: none; border-left: none;"><span class="f_TiporNote">Notes:</span></p>
</td>
</tr>
<tr style="text-align:left;">
<td width="952" bgcolor="#f7f7ff" style="width:952px; background-color:#f7f7ff;"><ul style="text-indent: 0px; margin-left: 14px; list-style-position: outside;">
<li><span class="f_TiporNoteText">This facility is available for Structural diagrams and Extended diagrams, but not for Behavioral diagrams (see the </span><span class="f_TiporNoteText" style="font-style: italic;"><a href="umldiagrams.htm">UML Diagrams</a></span><span class="f_TiporNoteText"> topic for a description of the diagram types). However, the facility is also available for Sequence diagrams generated by the Enterprise Architect Debugger.</span></li>
<li><span class="f_TiporNoteText">Dynamic and Analysis diagrams are </span><span class="f_TiporNoteText" style="font-weight: bold;">NOT</span><span class="f_TiporNoteText"> suited to this form of layout - please ensure first that the diagram type you are laying out benefits from the action.</span></li>
<li><span class="f_TiporNoteText">If you dislike the autolayout, you can reverse it </span><span class="f_TiporNoteText">before saving the diagram</span><span class="f_TiporNoteText">. Click </span><span class="f_MenuKeyField">[Ctrl]+[Z]</span><span class="f_TiporNoteText">.</span></li>
</ul>
</td>
</tr>
</table>
</div>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Layout a Diagram</span></p>
<p class="p_BodyText"><span class="f_BodyText">To layout a diagram, follow the steps below:</span></p>
<ol style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li value=1><span class="f_NumberedList">Select a diagram.</span></li>
<li value=2><span class="f_NumberedList">Click on either:</span></li>
</ol>
<ul style="text-indent: 0px; margin-left: 65px; list-style-position: outside;">
<li><span class="f_Bulletlist3">The </span><span class="f_Bulletlist3" style="font-weight: bold;">Diagram | Layout Diagram</span><span class="f_Bulletlist3"> option, or</span></li>
<li><span class="f_Bulletlist3">The </span><span class="f_Bulletlist3" style="font-weight: bold;">Auto Layout</span><span class="f_Bulletlist3"> button on the diagram toolbar.</span></li>
</ul>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Access the Diagram Layout Options Dialog</span></p>
<p class="p_BodyText"><span class="f_BodyText">For a fine degree of control of the elements in your diagram, you can use the </span><span class="f_UIControl">Diagram Layout Options</span><span class="f_BodyText"> dialog. Generally the default layout parameters provide adequate layouts for a wide range of diagrams, but there are times when more specific settings are required. To access the </span><span class="f_UIControl">Diagram Layout Options</span><span class="f_BodyText"> dialog, follow the steps below:</span></p>
<ol style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li value=1><span class="f_NumberedList">Double-click on the background of the diagram to display the </span><span class="f_UIControl">Diagram Properties</span><span class="f_NumberedList"> dialog.</span></li>
<li value=2><span class="f_NumberedList">Click on the </span><span class="f_UIControl">Diagram</span><span class="f_NumberedList"> tab, then click on the </span><span class="f_NumberedList" style="font-weight: bold;">Set Layout Style</span><span class="f_NumberedList"> button. The </span><span class="f_UIControl">Diagram Layout Options</span><span class="f_NumberedList"> dialog displays.</span></li>
<li value=3><span class="f_NumberedList">When you have made the required changes, click on the </span><span class="f_MenuKeyField">OK</span><span class="f_NumberedList"> button to save the changes.</span><br>
<span class="f_NumberedList">&nbsp;</span><br>
<img src="layoutoptions.png" width="407" height="320" border="0" alt="LayoutOptions"><br>
<span class="f_NumberedList">&nbsp;</span></li>
</ol>
<p class="p_BodyText"><span class="f_BodyText">You can alter any of the following settings on the </span><span class="f_UIControl">Diagram Layout Options</span><span class="f_BodyText"> dialog to refine your layout:</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_UIControl">Cycle Remove Options</span><span class="f_Bulletlist1"> panel - these settings remove cycles in the element organization (where element X is the source of a path but also becomes the target of a branch of the path), by reversing the connectors that impose the cycling and then reorganizing the diagram and reinstating the reversed relationships. This identifies the primary source element in the diagram.</span></li>
</ul>
<ul style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li><span class="f_Bulletlist2" style="font-weight: bold;">Greedy</span><span class="f_Bulletlist2"> - Select to use the </span><span class="f_Bulletlist2" style="font-style: italic;">Greedy Cycle Removal</span><span class="f_Bulletlist2"> algorithm, which minimizes the number of connectors reversed.</span></li>
<li><span class="f_Bulletlist2" style="font-weight: bold;">Depth First Search</span><span class="f_Bulletlist2"> - Select to use the </span><span class="f_Bulletlist2" style="font-style: italic;">Depth First Search Cycle Removal</span><span class="f_Bulletlist2"> algorithm, which establishes the longest linear sequence possible, before establishing parallel sequences and branches. This algorithm is less effective in large and/or complex diagrams, but produces a more natural layout than the </span><span class="f_Bulletlist2" style="font-style: italic;">Greedy</span><span class="f_Bulletlist2"> algorithm.</span></li>
</ul>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_UIControl">Crossing Reduction Options</span><span class="f_Bulletlist1"> panel - these options determine how long the routine should look for ways of reorganizing the layout to avoid crossed relationships:</span></li>
</ul>
<ul style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li><span class="f_Bulletlist2" style="font-weight: bold;">Iterations</span><span class="f_Bulletlist2"> - Type the number of iterations to be used during cycle removal (more than 8 does not usually provide any improvement).</span></li>
<li><span class="f_Bulletlist2" style="font-weight: bold;">Aggressive</span><span class="f_Bulletlist2"> - Select to use an aggressive (detailed and time-consuming) crossing reduction step.</span></li>
</ul>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_UIControl">Layering Options</span><span class="f_Bulletlist1"> panel - these settings determine how elements are organized in layers during layout:</span></li>
</ul>
<ul style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li><span class="f_Bulletlist2" style="font-weight: bold;">Longest Path Sink</span><span class="f_Bulletlist2"> - Select to use the </span><span class="f_Bulletlist2" style="font-style: italic;">Longest Path Sink Layering</span><span class="f_Bulletlist2"> algorithm, where the final target elements (</span><span class="f_Bulletlist2" style="font-style: italic;">sinks</span><span class="f_Bulletlist2">, which have no relationships issuing from them) are arranged in a layer at the top of the diagram, and the relationship paths built downwards from there in as many layers as there are nodes in the longest path.</span></li>
<li><span class="f_Bulletlist2" style="font-weight: bold;">Longest Path Source</span><span class="f_Bulletlist2"> - Select to use the</span><span class="f_Bulletlist2" style="font-style: italic;"> Longest Path Source Layering</span><span class="f_Bulletlist2"> algorithm, where the original </span><span class="f_Bulletlist2" style="font-style: italic;">source</span><span class="f_Bulletlist2"> elements (those with no relationships entering them) are arranged in a layer at the bottom of the diagram and the relationship paths built up from there in as many layers as there are nodes in the longest path.</span></li>
<li><span class="f_Bulletlist2" style="font-weight: bold;">Optimal Link Length</span><span class="f_Bulletlist2"> - Select to use the </span><span class="f_Bulletlist2" style="font-style: italic;">Optimal Link Length Layering</span><span class="f_Bulletlist2"> algorithm, which organizes the elements into whichever layers minimize the total source-to-sink relationship chain; in this layout you can have both source elements and sink elements at various levels of the diagram.</span></li>
</ul>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_UIControl">Layout Options</span><span class="f_Bulletlist1"> panel</span></li>
</ul>
<ul style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li><span class="f_Bulletlist2" style="font-weight: bold;">Layer Spacing</span><span class="f_Bulletlist2"> - Type the default number of logical units between layers of elements (vertical spacing).</span></li>
<li><span class="f_Bulletlist2" style="font-weight: bold;">Column Spacing</span><span class="f_Bulletlist2"> - Type the default number of logical units between elements within a layer (horizontal spacing).</span></li>
<li><span class="f_Bulletlist2" style="font-weight: bold;">Up</span><span class="f_Bulletlist2">,</span><span class="f_Bulletlist2" style="font-weight: bold;"> Down</span><span class="f_Bulletlist2">,</span><span class="f_Bulletlist2" style="font-weight: bold;"> Left</span><span class="f_Bulletlist2">,</span><span class="f_Bulletlist2" style="font-weight: bold;"> Right</span><span class="f_Bulletlist2"> - Select the direction in which directed connectors should point, to set the position of the primary source element and the overall flow of the diagram.</span></li>
</ul>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_UIControl">Initialize Options</span><span class="f_Bulletlist1"> panel - the autolayout routine inserts line waypoints and connectors into relationship paths to help plot the direction of relationships. The routine then assigns an index number to every node, such that nodes in the same layer are numbered left to right. The settings in this panel determine how those index numbers are assigned.</span></li>
</ul>
<ul style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li><span class="f_Bulletlist2" style="font-weight: bold;">Naive</span><span class="f_Bulletlist2"> - Select to use the </span><span class="f_Bulletlist2" style="font-style: italic;">Naive Initialize Indices</span><span class="f_Bulletlist2"> algorithm, which assigns index numbers to nodes as they are encountered in a sweep and tends to place all waypoints to the right of real nodes (and therefore long relationships between a small number of elements to the right of chains of short relationships between several elements).</span></li>
<li><span class="f_Bulletlist2" style="font-weight: bold;">Depth First Search Outward</span><span class="f_Bulletlist2"> - Select to use the </span><span class="f_Bulletlist2" style="font-style: italic;">Depth First Out Initialize Indices</span><span class="f_Bulletlist2"> algorithm, which assigns index numbers to nodes as they are encountered in a depth first search from source nodes outwards (and would therefore place longer relationship chains to the left of shorter chains, with the primary source node at the start of the diagram flow).</span></li>
<li><span class="f_Bulletlist2" style="font-weight: bold;">Depth First Search Inward</span><span class="f_Bulletlist2"> - Select to use the </span><span class="f_Bulletlist2" style="font-style: italic;">Depth First In Initialize Indices</span><span class="f_Bulletlist2"> algorithm, which also assigns index numbers to nodes as they are encountered in a depth first search, but from sink nodes inwards (and would therefore place longer relationship chains to the left of shorter chains, with the ultimate target node at the end of the diagram flow).</span></li>
</ul>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1" style="font-weight: bold;">Set as Project Default</span><span class="f_Bulletlist1"> checkbox</span></li>
</ul>
<ul style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li><span class="f_Bulletlist2">Select this checkbox to apply the diagram layout settings to all diagrams in the project. If you later check this box and click on the </span><span class="f_MenuKeyField">OK</span><span class="f_Bulletlist2"> button for a different diagram, the new settings override the settings saved earlier.</span></li>
</ul>
<p class="p_BodyText"><span class="f_BodyText">The following is an example of an automatically laid out diagram, with the following options set:</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1" style="font-weight: bold;">Depth First Search</span></li>
<li><span class="f_Bulletlist1" style="font-weight: bold;">Optimal Link Length</span></li>
<li><span class="f_Bulletlist1" style="font-weight: bold;">Depth First Search Outward</span></li>
<li><span class="f_Bulletlist1" style="font-weight: bold;">Direction - Up</span><span class="f_Bulletlist1">.</span></li>
</ul>
<p class="p_TextIndentedL2"><img src="diagramlayout.png" width="552" height="628" border="0" alt="DiagramLayout"></p>




            </div>
          </div>
        </div>



</div>


</body>
</html>
